package com.csylh.controller;

import com.csylh.VO.ResponseVO;
import com.csylh.entity.WasteInfo;
import com.csylh.service.WasteInfoService;
import com.csylh.util.ResponseVOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by 留歌
 * Date: 2018/3/12 23:34
 * Description:
 */
@RestController
@RequestMapping("/wasteInfo")
public class WasteInfoController {

    @Autowired
    private WasteInfoService wasteInfoService;

    /**
     * 返回一个指定类目的所有废品信息
     * @param type
     * @return
     */
    @GetMapping("/type/list")
    public ResponseVO getWasteInfo(@RequestParam("type") int type){
        List<WasteInfo> wasteInfoList = wasteInfoService.getWasteInfoByType(type);
        return ResponseVOUtil.success(wasteInfoList);
    }




}
